<?php


namespace app\demo\controller;


use app\index\model\Member;

class Test
{

    public function fin()
       {
           $memberModel = new Member();
           $data = $memberModel->select();
           echo json_encode($data);

           /* //叠加
            $sum = 1;
            $n = input('get.n');
            for ($i = 1; $i <= $n; $i++) {
                $sum = $sum * $i;
            }
            echo $sum;
        }

        public function explode()
        {
            $id = input('get.id');

                $idArray = explode('.',$id);
            foreach ($idArray as $value) {
                echo $value . '<br>';
            }
        }

        public function array1()
        {
            $array = array();
            //增加查改
            //增加
            $array[0] = '一个元素';
            $array[0] = '这是修改过后的第一个元素';
            $array[1] = '二个元素';
            $array[2] = '三个元素';
        echo json_encode($array);
        echo '<br>';
        //查找，其实就是遍历数组，依次拿到每一个元素的值
            echo '第一种遍历方式for循环' . '<br>';
            for ($i = 0; $i < sizeof($array);$i++) {
                echo $array[$i] . '<br>';
            }
            echo '第二种遍历方式foreach循环' . '<br>';
            foreach ($array as $value) {
                echo $value . '<br>';
            }
            echo '第三种遍历方式foreach循环键值方式' . '<br>';
            foreach ($array as $key => $value) {
                echo '键：' . $key . '| 值：' . $value . '<br>';
            }
        }
        
   /* public function server()

        /* $path = 'D:\ChangZhi\dnplayer2\dnutility.dll';
         echo getFileExt($path);
     }
     public function demo()
     {
         $path = 'D:\ChangZhi\dnplayer2\dnutility.dll';

     }

         /*if (empty(strrpos($path, '.'))) {
             echo '路径不合法';
             die();
         }
         echo '文件：' . $path . '<br>';
         echo '后缀名' . substr($path,strrpos($path,'.') + 1, strlen($path));*/

        /* echo strrpos($path, '.');*/

        /*$number = input('get.number');
        $number1 = input('get.number1');
        echo $number."|".$number1;
        $tot = 0;
        $tos = 0;
        $toc = 0;
        while ($number >= 0) {
            $tot = $tot + $number;
            $number--;
        }
        while ($number1 >= 0) {
            $tos = $tos + $number1;
            $number1--;
        }
        echo '<br>';
        echo $toc = $tot + $tos;





       /* $line = 1;
        while ($line <= $number) {
            $empty_pos = $star_pos = 1;
            $empty = 5 - $line;
            $star = 2 * $line - 1;
            while ($empty_pos <= $empty) {
                echo '&nbsp;';
                ++$empty_pos;
            }
            while ($star_pos <= $star) {
                echo '*';
                ++$star_pos;
            }
            echo '<br>';
            ++$line;
        }

    }*/

   /* public function array2()
    {
        $array = array();
        $array2 = array();
        $array2['one'] = '1';
        $array2['two'] = '2';
        $array2['thr'] = '3';
        $array2['fou'] = '4';
        $array['onearray'] = $array2;

        $array3 = array();
        $array3['fiv'] = '5';
        $array3['six'] = '6';
        $array3['sev'] = '7';
        $array3['eig'] = '8';
        $array['twoarray']=$array3;

        //遍历
        foreach ($array as $value) {
            foreach ($value as $val) {
                echo $val . '<br>';
            }
        }
        foreach ($array as $key => $value) {
            foreach ($value as $k => $v) {
                echo $v . '<br>';
            }
        }*/
    }
}

